package com.husd.dubbo.controller;

import com.husd.dubbo.api.IHelloService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.concurrent.atomic.AtomicLong;

@RestController
public class GreetingController {

    private Logger logger = LoggerFactory.getLogger(GreetingController.class);

    private static final String template = "Hello, %s!";
    private final AtomicLong counter = new AtomicLong();

    @DubboReference
    private IHelloService helloService;

    @GetMapping("/hello")
    public String home(HttpServletRequest request) {

        String name = request.getParameter("name");
        return helloService.hello(name);
    }

}
